package errmsg

const (
	SUCCESS = 200
	ERROR   = 500
	//	CODE=1000...用户模块的错误
	ErrorUsernameUsed   = 10001
	ErrorPwdWrong       = 10002
	ErrorUserNotExists  = 10003
	ErrorTokenExists    = 10004
	ErrorTokenWrong     = 10005
	ErrorTokenRuntime   = 10006
	ErrorTokenTypeWrong = 10007
	ErrorUserNoAdmin    = 10008

	ERROR_ART_NOT_EXIST = 20001
	// code= 3000... 分类模块的错误
	ERROR_CATENAME_USED  = 30001
	ERROR_CATE_NOT_EXIST = 30002
)

var CodeMsg = map[int]string{
	SUCCESS:             "OK",
	ERROR:               "FATAL",
	ErrorUsernameUsed:   "用户名已存在",
	ErrorPwdWrong:       "密码错误",
	ErrorUserNotExists:  "用户不存在",
	ErrorTokenExists:    "TOKEN不存在",
	ErrorTokenRuntime:   "TOKEN已过期",
	ErrorTokenWrong:     "TOKEN不正确",
	ErrorTokenTypeWrong: "TOKEN格式错误",
	ErrorUserNoAdmin:    "用户没有管理员权限",
	ERROR_ART_NOT_EXIST: "文章不存在",

	ERROR_CATENAME_USED:  "该分类已存在",
	ERROR_CATE_NOT_EXIST: "该分类不存在",
}

func GetErrMsg(code int) string {
	return CodeMsg[code]
}
